package consumer;

import commons.Greeter;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.bootstrap.DubboBootstrap;

public class ConsumerApp {
    public static void main(String[] args) {
        DubboBootstrap bootstrap=DubboBootstrap.getInstance();
        ReferenceConfig<Greeter> referenceConfig=new ReferenceConfig<>();
        referenceConfig.setInterface(Greeter.class);

//        referenceConfig.setUrl("dubbo://localhost:20880");
        bootstrap
                .application("consumer")
                .registry(new RegistryConfig("zookeeper://localhost:2181"))
                .reference(referenceConfig)
                .start();
        Greeter greeter = referenceConfig.get();
        System.out.println(greeter);
        System.out.println(greeter.sayHello("johnyu"));
    }
}
